package com.weiai.wedding.entity.cases;

import java.io.UnsupportedEncodingException;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.web.multipart.MultipartFile;

/**
 * 彩信内容
 * @author xushunxin
 *
 */
@Entity
@Table(name="cases_content")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CasesContent {
	/**
	 * 彩信内容ID
	 */
	private Long casesContentId;
	/**
	 * 彩信帧号
	 */
	private Long casesFramenum;
	/**
	 * 资源类型
	 */
	private String resType;
	/**
	 * 资源内容
	 */
	private String resContent;
	
	private String resContentStr;
	/**
	 * 彩信对象
	 */
	private Cases cases;
	/**
	 * 保存的文件名称
	 */
	private String fileName;
	/**
	 * 关联共享图片的资源ID
	 */
	private Long resourcesId; 
	/**
	 * 上传文件
	 */
	private MultipartFile file;	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getcasesContentId() {
		return casesContentId;
	}
	public void setCasesContentId(Long casesContentId) {
		this.casesContentId = casesContentId;
	}
	
	@Column(nullable = false,length = 10)
	public Long getcasesFramenum() {
		return casesFramenum;
	}
	public void setCasesFramenum(Long casesFramenum) {
		this.casesFramenum = casesFramenum;
	}
	@Column(nullable = false,length = 10)
	public String getResType() {
		return resType;
	}
	public void setResType(String resType) {
		this.resType = resType;
	}
	
	@Column(nullable = false)
	public String getResContent() {
		return resContent;
	}
	public void setResContent(String resContent) {
		this.resContent = resContent;
	}
	
	@Column(nullable = false,length = 50)
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	@ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)   
	@JoinColumn(name="cases_ID")//设置外键的名称  
	public Cases getCases() {
		return cases;
	}
	public void setCases(Cases cases) {
		this.cases = cases;
	}
	@Column(nullable = false,length = 10)	
	public Long getResourcesId() {
		return resourcesId;
	}
	public void setResourcesId(Long resourcesId) {
		this.resourcesId = resourcesId;
	}
	
	@Transient	
	public MultipartFile getFile() {
		return file;
	}
	public void setFile(MultipartFile file) {
		this.file = file;
	}
	@Transient
	public String getResContentStr() {
		return resContentStr;
	}
	public void setResContentStr(String resContentStr) {
		this.resContentStr = resContentStr;
	}
	
	
}
